<template>
<div>
   <van-nav-bar
      title="详情"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
    />
  <van-pull-refresh v-model="loading" @refresh="onRefresh" >
    <van-list
      v-model="loading"
      :finished="finished"
      finished-text="没有更多了"
      @load="onLoad"
    >
      <van-cell v-for="(v, i) in list" :key="i">
        <Dongtai :dynamicRecord="v"></Dongtai>
        <van-cell title="前往处理" is-link @click="jianguandetil(v)"  />
      </van-cell>
    </van-list>
  </van-pull-refresh>
</div>
</template>

<script>
import Dongtai from "./dongtai.vue";
export default {
    components:{
        Dongtai
    },
  data() {
    return {
      list: [],
      loading: false,
      finished: false,
      refreshing: false,
    };
  },
    methods: {
    onLoad() {
      //上拉刷新
      this.$axios
        .get(`${this.$api}complaints/0`)
        .then((res) => {
           
          this.list = res.data;
        });
          this.isLoading = false; //下拉刷新请求完成
          this.loading = false; //上拉加载更多请求完成
    },
    onRefresh() {
      //下拉刷新
      // 清空列表数据
      this.finished = false;

      // 重新加载数据
      // 将 loading 设置为 true，表示处于加载状态
      this.loading = true;
      this.onLoad();
    },
    jianguandetil(item){
      this.$router.push({
        name:'jianguandetil',
        params: {
          detail:item
        }})
      
    
    },
    onClickLeft(){
         this.$router.push("/use");
    }
  },
};
</script>

<style>
</style>